package week10;

//********************************************************************
//  Magazine.java       Author: Lewis/Loftus
//
//  Represents a single magazine.
//********************************************************************

public class Magazine implements Comparable
{
    private String title;

    //-----------------------------------------------------------------
    //  Sets up the new magazine with its title.
    //-----------------------------------------------------------------
    public Magazine(String newTitle)
    {
        title = newTitle;
    }

    public String getTitle(){
        return this.title;
    }

    //-----------------------------------------------------------------
    //  Returns this magazine as a string.
    //-----------------------------------------------------------------
    public String toString()
    {
        return title;
    }

    public int compareTo(Object other)
    {
        int result;

        String otherTitle = ((Magazine)other).getTitle();
        result = this.title.compareTo(otherTitle);

        return  result;
    }
}
